package at.ac.thornwishstalon.ocrapp.pic.preferences;


import at.ac.thornwishstalon.ocrapp.R;
import android.annotation.TargetApi;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.util.Log;

public class PicPreferenceActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener{
	public static final String SHOW_CHAR_BOUNDING_BOXES="pic_pref_show_BoundingBoxes_checkbox";
	public static final String SHOW_TEXTLINES="pic_pref_show_TextLines_checkbox";
	public static final String SHOW_REGIONS="pic_pref_show_Regions_checkbox";
	public static final String TAG="PicPreferenceActivity";

	@TargetApi(11)
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		// fragments require 3.0..
		super.onCreate(savedInstanceState);
		getFragmentManager().beginTransaction()
        .replace(android.R.id.content, new PicPrefFragment())
        .commit();
		
		PreferenceManager.setDefaultValues(this, R.xml.pic_preferences, false);
		//Preference showBoundingBoxes = findPreference("pic_pref_show_BoundingBoxes_checkbox");
	}

	public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
			String key) {
		Log.i(TAG, "prefs changed");
		
	}

	/*
	// for proper lifecycle management
	@SuppressWarnings("deprecation")
	@Override
	protected void onResume() {
	    super.onResume();
	    getPreferenceScreen().getSharedPreferences()
	            .registerOnSharedPreferenceChangeListener(this);
	}
	// for proper lifecycle management
	@SuppressWarnings("deprecation")
	@Override
	protected void onPause() {
	    super.onPause();
	    getPreferenceScreen().getSharedPreferences()
	            .unregisterOnSharedPreferenceChangeListener(this);
	}
	*/
	
}
